import java.awt.event.KeyListener;
import java.awt.event.KeyEvent;
/** Handles key events */
/** MyKeyListener implements the KeyListener Interface and handles Key Events */

public class MyKeyListener implements KeyListener {
	
	// Defaukt Key
	private char keyChar = 'A';
	
/** This Method Handles events when the Key is pressed */	
public void keyPressed (KeyEvent Event){
	//Switch Statement recieves Key pressed and maps it to the corresponding Action
	switch (Event.getKeyCode()) {

	case KeyEvent.VK_LEFT:
		
		MasterControl.Left_Pressed = true;
		MasterControl.Left_Released = false;
		
		break;
	case KeyEvent.VK_RIGHT:
							
		MasterControl.Right_Pressed = true;
		MasterControl.Right_Released = false;
		
		break;
	case KeyEvent.VK_DOWN:
		
		MasterControl.Down_Pressed = true;
		MasterControl.Down_Released = false;
		
		break;
	case KeyEvent.VK_UP:
		
		MasterControl.Up_Pressed = true;
		MasterControl.Up_Released = false;
		
		break;
	case KeyEvent.VK_S:
		
		MasterControl.S_Pressed = true;
		MasterControl.S_Released = false;
		
		break; 
	case KeyEvent.VK_A:
		
		MasterControl.A_Pressed = true;
		MasterControl.A_Released = false;
		
		break; 
	case KeyEvent.VK_D:
		
		MasterControl.D_Pressed = true;
		MasterControl.D_Released = false;
		
		break;
	case KeyEvent.VK_ENTER:
		//PAUSE
		break;	
	default:
		keyChar = Event.getKeyChar();

	}
//	Consumes a key so it won't be used with another key EX : ALT + F
	Event.consume();
}

/** The Method Handles events when the Key is Released */
public void keyReleased (KeyEvent Event){
//	Switch Statement recieves Key Released and maps it to the corresponding Action
	switch (Event.getKeyCode()) {
	
	case KeyEvent.VK_LEFT:
		
		MasterControl.Left_Pressed = false;
		MasterControl.Left_Released = true;
		
		break;
	case KeyEvent.VK_RIGHT:
		
		MasterControl.Right_Pressed = false;
		MasterControl.Right_Released = true;
		
		break;
	case KeyEvent.VK_DOWN:

		MasterControl.Down_Pressed = false;
		MasterControl.Down_Released = true;
		
		break;	
	case KeyEvent.VK_UP:
		
		MasterControl.Up_Pressed = false;
		MasterControl.Up_Released = true;
		
		break;	
	case KeyEvent.VK_S:
		
		MasterControl.S_Pressed = false;
		MasterControl.S_Released = true;
		
		break;
	case KeyEvent.VK_A:
		
		MasterControl.A_Pressed = false;
		MasterControl.A_Released = true;
		
		break;
	case KeyEvent.VK_D:
		
		MasterControl.D_Pressed = false;
		MasterControl.D_Released = true;
		
		break;
	case KeyEvent.VK_ENTER:
		// NOTHING
		break;		
	default:
		keyChar = Event.getKeyChar();

	}
//	Consumes a key so it won't be used with another key EX : ALT + F
	Event.consume();
}
// Not sure what It's for
public void keyTyped (KeyEvent Event){
	
//	Consumes a key so it won't be used with another key EX : ALT + F
	Event.consume();
}

}